package com.greatwqs.wmall.user.client.enums;

import lombok.Getter;

/**
 * user.user_status:
 * User status: 1 created, 2 logged, 3 blocked
 *
 * @author wang-qingsong
 */
@Getter
public enum UserStatusType {

    CREATED(1, "created， but not logged"),
    LOGGED(2, "logged"),
    BLOCKED(3, "blocked");

    private final int value;
    private final String message;

    private UserStatusType(int value, String message)  {
        this.value = value;
        this.message = message;
    }

    public static UserStatusType ofNullable(int value) {
        for (UserStatusType type : UserStatusType.values()) {
            if (type.getValue() == value) {
                return type;
            }
        }
        return null;
    }
}
